package com.example.demorabbitmqlisten.rabbitmq;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

/**
 * SpdCloud消息业务类型
 *
 * @author rockzhan 2021-04-08 22:44
 * @version 1.0
 */
public enum SpdCloudOperationType {

    /** 供应商信息上传 UPLOAD_SUPPLIER */
    UPLOAD_SUPPLIER("UPLOAD_SUPPLIER", "供应商信息上传", "uploadHospitalSupplierService"),
    /** 商品信息上传 UPLOAD_PRODUCT */
    UPLOAD_PRODUCT("UPLOAD_PRODUCT", "商品信息上传", "uploadProductService"),
    /** 上传出库信息 UPLOAD_CHECKOUT_DETAILS */
    UPLOAD_CHECKOUT_DETAILS("UPLOAD_CHECKOUT_DETAILS", "上传出库信息", "uploadCheckoutDetailsService"),
    /** 上传反馈信息 UPLOAD_HOSPITAL_RESULT */
    UPLOAD_HOSPITAL_RESULT("UPLOAD_HOSPITAL_RESULT", "反馈信息上传", "uploadHospitalResultService"),
    /** 耗材出库信息 UPLOAD_HAOCAI_CHUKU_RESULT*/
    UPLOAD_HAOCAI_CHUKU_RESULT("UPLOAD_HAOCAI_CHUKU_RESULT", "耗材出库", "keShiKuCunService");

    /**
     * MQ消息类型
     */
    @Getter
    private final String operationType;
    /**
     * 消息类型名称
     */
    @Getter
    private final String name;
    /**
     * 实现Bean Name
     */
    @Getter
    private final String implementBeanName;

    SpdCloudOperationType(String operationType, String name, String implementBeanName) {
        this.operationType = operationType;
        this.name = name;
        this.implementBeanName = implementBeanName;
    }

    public static SpdCloudOperationType getByOperationType(String operationType) {
        for (SpdCloudOperationType ot : SpdCloudOperationType.values()) {
            if (StrUtil.equals(operationType, ot.operationType)) {
                return ot;
            }
        }
        return null;
    }
}
